#!/usr/bin/perl
# use strick;

# [Perl教程](https://www.runoob.com/perl/perl-tutorial.html)

#yum install perl-JSON
	
sub mute {
}
 
sub assert(x) {
    if(!x) {
        # TODO
    }
}

sub vari {
    print "变量常量\n";
    $i = 0;
    $f = 1.0;
    #特殊变量
    #	$_	默认值变量
    #	$”
    #	$/
    #	$2
    #	$$
}
sub stri{
    print "字符串\n";
    $s = "s"
}

sub coll{
    print "数组集合\n";
    @arr =[];
    @arr = (5, 'apple', $x. 3.14159);
    @range = (1 .. 10);
    %hash = ('abc'=>'val',"def"=>"ccd");

    $hash{'abc'};

    for $a (@arr) {
        mute($a);
    }

    foreach $k (keys %hash) {
        mute($hash[$k])
    }

    $e = 4;
    @e = (4);
    pop(@a);
    push(@a,$e);
    push(@a,@e);
    shift(@a);
    unshift(@a,$e);
}

sub proc{
    print "流程控制\n";

    if(1){
    } elsif(2){
    } else{
    }

    for ( $i=0; $i<10; $i++){
        mute($i)
    }
}
sub func{
    print "函数方法\n";
    sub f {
        $_[0]+$_[1]
    }
    f(1,2)
}

sub clas{
    print "类和对象\n";
}

sub main {
    print "Hellow, World!\n";
    vari();
    stri();
    coll();
    proc();
    func();
    clas();
}

main()
